﻿<Window x:Class="Animation.XamlAnimation"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="XamlAnimation" Height="300" Width="300" Name="window"
    xmlns:local="clr-namespace:Animation"
    >
  <Window.Resources>
    <local:ArithmeticConverter x:Key="converter"></local:ArithmeticConverter>
  </Window.Resources>
  <Button Padding="10" Name="cmdGrow" Height="40" Width="160"
          HorizontalAlignment="Center" VerticalAlignment="Center">
    <Button.Triggers>
      <EventTrigger RoutedEvent="Button.Click">        
        <EventTrigger.Actions>
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation Storyboard.TargetProperty="Width"
                To="{Binding ElementName=window,Path=Width,Converter={StaticResource converter},ConverterParameter=-30}"
                               Duration="0:0:5"></DoubleAnimation>
              <DoubleAnimation Storyboard.TargetProperty="Height"
                To="{Binding ElementName=window,Path=Height,Converter={StaticResource converter},ConverterParameter=-50}"
                               Duration="0:0:5"></DoubleAnimation>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger.Actions>
      </EventTrigger>
    </Button.Triggers>
    <Button.Content>
      Click and Make Me Grow
    </Button.Content>
  </Button>
</Window>
